from tc_tool_line import tc_tool_line
from dataholder import dataholder
from graphics import graphics
class toolholder():
    tools=[]# a list of tuples (toolclass, param) is a tool 
    def __init__(self,data=dataholder(""),size=(640,480)):
        self.data=data
        self.graphics=graphics(size)
        
        # # # # # #
        #
        #   THE GREAT LIST OF ALL TOOLS
        #
        #
        tmptools=[]
        tmptools.append((tc_tool_line,0))
        tmptools.append((tc_tool_line,1))
        tmptools.append((tc_tool_line,2))
        tmptools.append((tc_tool_line,4))
        
        # Determin active tools for this artist/session
        nr_of_tools=1+self.data.get0to(2)
        for i in range(nr_of_tools):
            nr_of_avail_tools=len(tmptools)
            toolpick=self.data.get0to(nr_of_avail_tools-1)
            self.tools.append(tmptools[toolpick])
            tmptools.pop(toolpick)
        # set the current_tool to something
        self.switch()

    def switch(self):
        nr_of_tools=len(self.tools)
        tool_nr=self.data.get0to(nr_of_tools-1)
        self.current_tool=self.tools[tool_nr][0](self.graphics,version=self.tools[tool_nr][1])
        

if __name__ == "__main__":
    data=dataholder("AAASShan")
    th=toolholder(data,(1024,768))
    print th.tools
        
